<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>组织架构</title>
    <link rel="stylesheet" href="../css/layui.css">
    <link rel="stylesheet" href="../css/index.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo"><img id="logo" src="../../images/pic/u74.png"></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    操作
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="">退出系统</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-blue" id="side">
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div class="layui-row" id="breadNavi">
            <div class="layui-col-xs6">
                <span class="layui-breadcrumb">
                  <a href="">/基础数据管理</a>
                  <a href="">组织架构</a>

                </span>

            </div>
            <div class="layui-col-xs6">

            </div>
        </div>
        <div class="layui-row">
            <div class="layui-col-xs4">
                <ul id="dept1" lay-filter="dept" ></ul>
            </div>
            <div class="layui-col-xs4">
                <ul id="dept" lay-filter="dept" ></ul>
            </div>
            <div class="layui-col-xs4">
                <ul id="dept3" lay-filter="dept" ></ul>
            </div>
            <button class="layui-btn layui-btn-normal" id="addNode">添加节点</button>
        </div>

    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>
<script src="../layui.js"></script>
<script src="../js/config.js"></script>
<script src="../js/tools.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['form' ,'tree','element','tree'], function(){
        var form = layui.form;
        var element = layui.element;
        var tree = layui.tree;
        var layer = layui.layer;
        var $ = layui.$;
        $("#addNode").click(function () {
            layer.open({
                type: 2,
                title: '新增客户信息',
                maxmin: true,
                shadeClose: true, //点击遮罩关闭层
                area : ['700px' , '700px'],
                content: './newNode.html',
                end:function(){
                    tree.render();
                }
            });
        });







        $.ajax({
            url: contextPath+"/dept/tree",
            type: "GET",
            contentType:"application/json;charset=utf-8",
            dataType:"json",
            success: function(res) {

                layui.tree({
                    elem: '#dept' //传入元素选择器
                    ,nodes: res.list
                });
            }

        });



    });





</script>
</body>
</html>